import { IUploadChunkParams } from '@/utils/file';
import request from '@/utils/request';

export const vertifyFile = (data) => {
  return request.post('/nest/file/verify', data);
};

export const mergeFile = (data) => {
  return request.post('/nest/file/merge', data);
};

export const uploadChunk = (data: IUploadChunkParams) => {
  console.log(data.chunk, 'data--------chunk');
  const formData = new FormData();
  formData.append('chunk', new Blob([data.chunk]));
  formData.append('chunkIndex', data.chunkIndex.toString());
  formData.append('fileHash', data.fileHash);
  formData.append('extname', data.extname);
  console.log(formData, 'formData--data');
  return request.post('/nest/file/upload', formData);
};
